package com.example.networktest

fun main() {
    println(translateNum(12258))
}

fun translateNum(num: Int): Int {
    val s = num.toString()
    val arr = IntArray(s.length)
    for (i in 0 until s.length) {
        arr[i] = s[i] - '0'
    }
    val dp = IntArray(s.length + 1)
    dp[0] = 1
    for (i in 1 until dp.size) {
        val str = arr[i - 1].toString() +
                arr[i]
        val temp = str.toInt()
        if (temp > 25) {
            dp[i] = dp[i - 1] + 1
        } else {
            dp[i] = dp[i - 1]
        }
    }
    return dp[s.length]
}